package com.hrprojectback.controller;

import com.hrprojectback.dto.User;
import com.hrprojectback.service.LoginUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    private LoginUserService loginUserService;

    @RequestMapping("/login")
    public String Login(@RequestBody User user) {

        //查询用户是否存在
        Integer counts = loginUserService.loginUser(user.getUsername(), user.getPassword());
        if (counts > 0) {
            return "ok";
        } else {
            return "no";
        }
    }
}
